GetOrganizationalUnits Method

Syntax

GetOrganizationalUnits as P ()

Returns

organizationalUnitsArray of WindowsServices::ActiveDirectory::OrganizationalUnit (use as type P)

Returns an array of WindowsServices::ActiveDirectory::OrganizationalUnit objects. Check the domain object's CallResult to see if the method succeeds.

Description

Get the organizational units for a WindowsServices::ActiveDirectory::Domain object.

'The follow line assumes that the machine is joined to an Active Directory domain and is allow to query Active Directory.
dim domain as WindowsServices::ActiveDirectory::Domain = new WindowsServices::ActiveDirectory::Domain()
if .not. domain.CallResult.Success then
	?"There was an error connecting to an Active Directory domain: " + domain.CallResult.Text +  crlf()
	goto exitTestFunction
end if
	
?"The domain name is " + domain.Name + crlf()

dim ous as p
ous = domain.GetOrganizationalUnits()
if .not. domain.CallResult.Success then
	?"There was an error getting organizational units: " + domain.CallResult.Text +  crlf()
	goto exitTestFunction
end if

for each ou in ous
	?ou.Name + " (" + ou.DistinguishedName + ")" + crlf()
next
	
exitTestFunction: